<template>
	<!-- 顶部选项卡 -->
	<view class="tabs">
		<view class="uni-tab-item" v-for="(tab,index) in tabBars" :key="tab.id">
			<text class="uni-tab-item-title" :class="{tabActive: tabIndex==tab.id}" @tap="tarTap(tab)">
				{{tab.name}}
				<span class="tab-item-title-line"></span>

			</text>
		</view>
	</view>
</template>

<script>
	export default {
		name: "index-tabbar",
		props: {
			tabBars: Array,
			tabIndex: String
		},
		data() {
			return {

			}
		},
		methods: {
			tarTap(item) {
				this.$emit("TarTap", item)
			}
		}
	}
</script>

<style>
	.tabs {
		display: flex;
		flex: 1;
		flex-direction: row;
		height: 120rpx;
		background-color: #363EDF;
	}

	.uni-tab-item {
		width: 260rpx;
		white-space: nowrap;
		line-height: 100rpx;
		height: 120rpx;
		border-bottom: 1px solid #eee;
		/* margin: 0 auto; */
		margin-top: 10rpx;
		text-align: center;
	}

	.uni-tab-item-title {
		color: #969696;
		font-weight: 400;
		font-size: 38rpx;
		width: 150rpx;
		display: inline-block;
		text-align: center;
		color: #B2B7FC;
		margin-left: 160rpx;
	}

	.tabActive {
		color: #fff;
		font-size: 42rpx;
	}

	.tabActive .tab-item-title-line {
		display: block;
		border-bottom: 2rpx solid #fff;
		border-top: 2rpx solid #fff;
		width: 40rpx;
		margin: 0 auto;
		border-radius: 25%;
		margin-top: -4px;
		background-color: #fff;
		box-sizing: border-box;
	}
</style>
